////////////////////////////////////////////////////////////////////////////////
//
// Licensed under the MIT License
//
// Copyright (c) 2008 Chris Colinsky
// All Rights Reserved
//
// version	0.4
// http://code.google.com/p/sugarcookie/
// http://code.google.com/p/sugarcookie/wiki/License
//
////////////////////////////////////////////////////////////////////////////////

import sugarcookie.validators.ValidationResult;

class sugarcookie.validators.StringValidator {
	public static var maxChar:Number = null;
	public static var minChar:Number = 1;
	
	public static function validate(value:Object):ValidationResult {
		if (String(value).length<minChar) return new ValidationResult("String value length is too short or String is empty",true);
		else if (String(value).length>maxChar && maxChar!=null) return new ValidationResult("String value length is too long",true);
		else new ValidationResult("String is valid",false);
	}
}